package view;

import service.AdminService;
import service.StudentMangerService;

import java.util.Scanner;

public class ConsoleView {
    StudentMangerService studenManagerView = new StudentMangerService();
    //登录
    public void LoginView()
    {
        String adminUsername;
        String adminPassword;
        boolean islogin;
        AdminService adminloginService = new AdminService();
        //获取账号密码
        //获取键盘输入的账号
        Scanner scanner = new Scanner(System.in);
        System.out.println("管理员账号:");
        adminUsername=scanner.nextLine();
        System.out.println("管理员密码:");
        adminPassword=scanner.nextLine();
        islogin=adminloginService.login(adminUsername, adminPassword);
        if(islogin){
            System.out.println("登陆成功");

        }else{
            System.out.println("登陆失败");
            System.out.println("账号或密码错误请再次输入");
            LoginView();
        }
        MenuView();
    }
    //菜单
    public void MenuView()
    {
        System.out.println("==============");
        System.out.println("1,新增学生");
        System.out.println("2,删除学生");
        System.out.println("3,查找学生");
        System.out.println("4,修改学生");
        System.out.println("5,退出学生");
        System.out.println("==============");
        int num = studenManagerView.selectMenuNumber();
        System.out.println("用户选择了："+num);

    }
}
